package zky410;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Stack;


public class teat1 {
    public static void main(String[] args) throws IOException {
        BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(sc.readLine());
        String[] s = sc.readLine().split(" ");
        int[] str = new int[N];
        for (int i = 0; i < N; i++) {
            str[i] = Integer.parseInt(s[i]);
        }
        int num = num(str);
        System.out.println(num);

    }
    public static int num(int[] str){

        int[] dp = new int[str.length];
        dp[0] = 0;
        for (int i = 1; i <str.length ; i++) {
            dp[i] = str.length+1;
        }
        for (int i = 0; i < str.length ; i++) {
            for (int j = 1; j <= str[i]; j++) {
                if(j+i >= str.length){
                    return dp[str.length-1];

                }
                dp[i+j] = Math.min(dp[i+j],dp[i]+1);
            }
        }return dp[str.length-1];
    }

//    public static int num(int[] str){
//        if(str == null || str.length == 0){
//            return 0;
//        }
//        int start = 0;
//        int end = 0;
//        int res = 0;
//        int temp = 0;
//        while(end<str.length-1){
//            temp = end;
//            end = result(str,start,end);
//            start = temp;
//            res++;
//        }return res;
//
//    }
    public static int result(int[] str,int start,int end){
        int max = 0;
        for(int i =start;i<= end;i++){
            if(i+str[i]>max){
                max = i+str[i];
            }
        }return max;
    }

}
